<?php
session_start();

require_once("database.include.php");

	print "Messages (table message)<br/><table border=`1`>";
	print "<tr><td bgcolor=darkgray><font color=white>message_id</font></td>
	<td bgcolor=darkgray><font color=white>group_name</font></td>
	<td bgcolor=darkgray><font color=white>user_name</font></td>
	<td bgcolor=darkgray><font color=white>message</font></td>
	<td bgcolor=darkgray><font color=white>retention_mode</font></td>
	<td bgcolor=darkgray><font color=white>expiration_date</font></td></tr>";
	
    $sql = 'SELECT `message_id`, `group_name`, `user_name`, `message`, `retention_mode`, `expiration_date` FROM `message` ORDER BY `message_id`';
    
    foreach ($conn->query($sql) as $row) {
    	print "<tr>";
        print "<td>" . $row['message_id'] . "</td>";
        print "<td>" . $row['group_name'] . "</td>";
        print "<td>" . $row['user_name'] . "</td>";
		print "<td>" . $row['message'] . "</td>";
		print "<td>" . $row['retention_mode'] . "</td>";
		print "<td>" . $row['expiration_date'] . "</td>";
        print "</tr>";
    }
    print "</table>";

?>